package com.hbfec.mqttmanager.service;

import com.hbfec.mqttmanager.entity.MessageEntity;
import com.hbfec.mqttmanager.mapper.MessageMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.MessagingException;


public class SQLHandler implements MessageHandler{

    @Autowired
    private MessageMapper mm;
    @Override
    public void handleMessage(Message<?> message) throws MessagingException {
        MessageEntity me = MessageEntity.parse(message);
        mm.insert(me);
    }
}
